﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using BUSINESS_OBJECT;

namespace CRM.admin
{
    public partial class invoice : System.Web.UI.Page
    {

        Invoicecls incls = new Invoicecls();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = incls.GetRecords(-99, "", "", -99,"", -99,Convert.ToDateTime( "1/1/1800"), false, " and ");
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
        }

        

        

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                DataTable dt = incls.GetRecords(Convert.ToInt64(e.CommandArgument.ToString()),"", "", -99, "", -99,Convert.ToDateTime( "1/1/1800"), false, " and ");
                incls.ID = Convert.ToInt64(dt.Rows[0]["ID"].ToString());
                incls.COMPANY_NAME = dt.Rows[0]["COMPANY_NAME"].ToString();
                incls.COMPANY_ADDRESS = dt.Rows[0]["COMPANY_ADDRESS"].ToString();
                incls.PHONE_NO = Convert.ToInt64(dt.Rows[0]["PHONE_NO"].ToString());
                incls.EMAIL_ID = dt.Rows[0]["EMAIL_ID"].ToString();
                incls.PAYMENT = Convert.ToInt64(dt.Rows[0]["PAYMENT"].ToString());
                incls.DATE = Convert.ToDateTime(dt.Rows[0]["DATE"].ToString());
                incls.ISDELETED = true;
                incls.SaveRecords();
                Response.Redirect("~/admin/invoice.aspx");
            }

        }
    }
}
